<?php
// Get the slideshow stuff and show it!
$args = array(
	'post_type' => 'echotheme_slideshow',
	'posts_per_page' => -1,
	'orderby' => 'menu_order'
);

$query = new WP_Query($args);
if ($query->have_posts()) :
?>
<div id="home-slideshow" class="controls-container">
<div class="flexslider">
	<ul class="slides">

<?php
while ($query->have_posts()):
$query->the_post();
$attr = array(
	
);
$attr = array(
	'title' => ''
);
$image = get_the_post_thumbnail(get_the_ID(), 'slideshow', $attr);
// remove the height for the flexslider
$image = remove_thumbnail_height($image);
$title = get_the_title();
$content = get_the_content();
$link = get_custom_value('slide-link');
?>
		<li>
			<?php 
			echo $image; 
			if ($title || $content): ?>
			<div class="slide-content-container">
				<article>
					<?php if ($link): ?>
					<a href="<?php echo $link; ?>">
					<?php endif ?>
					<header>
						<h1>
							<?php the_title(); ?>
						</h1>
						<?php echo $content; ?>
					</header>
					<?php if ($link): ?>
					</a>
					<?php endif ?>
				</article>
			</div>
			<?php endif ?>
			
			
		</li>
<?php
endwhile;
?>

	</ul>
	<div class="controls-inner"></div>
</div> <!-- end #slideshow -->
</div> <!-- end #slideshow-controls -->
<script type="text/javascript" charset="utf-8">
	$(window).load(function() {
	    $('#home-slideshow').flexslider(
			{
				controlsContainer: "#home-slideshow.controls-container .controls-inner",
				pauseOnHover: true,
			}
		);
	  });
</script>
<?php
endif;
?>